#pragma comment(linker, "/STACK:10000000")
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <cstdio>
#include <cassert>
#include <string>
#include <cstring>
#define ldb long double
#define ll long long
#define fi first
#define se second
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define fill(a, c) memset(a, c, sizeof(a))
#define sqr(a) ((a) * (a))
#define nextLine() {int c = 0; while((c = getchar()) != 10 && c != EOF);}
#define getBit(mask, k) (((mask) / pw[k]) % pw[1])
#define setBit(mask, k, l) (((mask) / pw[k + 1] * pw[1] + (l)) * pw[k] + ((mask) % pw[k]))
#define debug(a) cerr << #a << " = " << (a) << " ";
#define debugl(a) cerr << #a << " = " << (a) << "\n";
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define ff first
#define ss second 
const ldb eps = 1e-9;
const int inf = 1 << 28;
const ldb pi = fabsl(atan2l(0.0, -1.0));
using namespace std;

int n, m, k;
#define MV 100010
#define ME 200010
int fst[MV], nxt[ME], end[ME], edgs;
bool was[MV * 10];
int d[MV * 10];
int q[MV * 10], qh, qt;
int v[12];


inline void add_edge(int i, int j)
{
	nxt[edgs] = fst[i];
	fst[i] = edgs;
	end[edgs] = j;
	edgs++;
}

void load()
{
	cin >> n >> m >> k;
	memset(fst, -1, sizeof fst);
	int a, b;
	for (int i = 0; i < m; i++)
	{
		scanf("%d%d", &a, &b);
		add_edge(a, b);
		add_edge(b, a);
	}
	for (int i = 0; i < k; i++)
		scanf("%d", &v[i]);
}

inline int code(int i, int j)
{
	return i * k + (j % k);
}

void solve()
{
	q[qt++] = 1 * k;
	was[1 * k] = 1;
	d[1 * k] = 0;
	int ver;
	while (qh < qt)
	{
		ver = q[qh++];
		int i = ver / k;
		int j = ver - i * k;
		if (i == v[j]) continue;
		if (i == n)
		{
			cout << d[ver];
			return;
		}
		int to = code(i, j + 1);
		if (!was[to])
		{
			q[qt++] = to;
			was[to] = 1;
			d[to] = d[ver] + 1;
		}
		for (int u = fst[i]; u != -1; u = nxt[u])
		{
			to = code(end[u], j + 1);
			if (!was[to] && (end[u] != v[j] || v[(j + 1) % k] != i))
			{
				was[to] = 1;
				q[qt++]  = to;
				d[to] = d[ver] + 1;
			}
		}
	}
	cout << -1;
}

#define file "badsanta"
int main()
{
	freopen(file".in", "rt", stdin);
	freopen(file".out", "wt", stdout);
	load();
	solve();
	return 0;
}
